/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
}

/* 公共样式变量 */
$primary-color: #3478f6;
$text-primary: #333;
$text-secondary: #666;
$border-color: #eaedf0;
$bg-light: #f5f7fa;
$bg-lighter: #f8f9fc;

/* 通用样式辅助类 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 组件深度选择器样式覆盖 */
:deep(.van-grid-item__content) {
  padding: 2px;
}

:deep(.van-notify--success) {
  font-size: 10px !important;
}

:deep(.van-tag) {
  margin-top: 10px;
  padding: 3px 5px;
}

:deep(.van-action-sheet__description) {
  padding: 0;
}

:deep(.van-floating-panel__header) {
  display: none;
}

/* 页面容器样式 */
.ground-live-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;

  /* 地图工具栏样式 */
  .map-left-tools,
  .map-right-tools {
    position: absolute;
    top: 20px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 38px;
    box-sizing: border-box;

    .tool-btn {
      width: 100%;
      display: flex;
      align-items: center;
      flex-direction: column;
      justify-content: center;
      border-radius: 10%;
      font-size: 28px;
      padding: 2px 0 0;
      background: #fff;
      box-sizing: border-box;
      cursor: pointer;
      transition: background-color 0.3s;
    }
  }

  .map-right-tools {
    left: unset;
    right: 10px;
  }
}

/* 地图图层标题样式 */
.layerTitle {
  font-size: 11px;
  padding: 2px 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.3);
}

/* 面板拖动指示器样式 */
.panel-drag-indicator {
  width: 100%;
  height: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;

  .drag-handle {
    width: 36px;
    height: 4px;
    background-color: #ddd;
    border-radius: 4px;
    margin-bottom: 4px;
  }

  .drag-hint {
    font-size: 10px;
    color: #999;
    transform: translateY(-2px);
    animation: pulse 2s infinite;
  }
}

/* 面板通用动画效果 */
@keyframes pulse {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* 设备管理面板样式 */
.device-panel {
  padding: 30px 16px 20px;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  overflow-y: auto;

  /* 面板头部样式 */
  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;

    span {
      font-size: 16px;
      font-weight: bold;
      color: $text-primary;
    }

    .close-btn {
      position: absolute;
      right: 10px;
      top: 10px;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;

      svg {
        font-size: 18px;
        color: $text-secondary;
      }
    }
  }

  /* 设备统计卡片样式 */
  .device-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;

    .device-stat-item {
      flex: 1;
      background: $bg-lighter;
      border-radius: 12px;
      padding: 12px 8px;
      display: flex;
      align-items: center;
      margin: 0 4px;
      border: 2px solid transparent;
      transition: all 0.2s;

      &.active {
        border-color: $primary-color;
        background-color: #f0f7ff;
      }

      .device-icon {
        width: 28px;
        height: 28px;
        object-fit: contain;
        margin-right: 8px;
      }

      .stat-data {
        display: flex;
        flex-direction: column;

        .stat-count {
          font-size: 18px;
          font-weight: bold;
          color: $primary-color;
        }

        .stat-name {
          font-size: 12px;
          color: $text-secondary;
          margin-top: 2px;
        }
      }
    }
  }

  /* 高级设置区域样式 */
  .advanced-settings {
    padding-top: 5px;
    border-top: 1px dashed #eee;

    .settings-title {
      font-size: 15px;
      font-weight: bold;
      color: $text-primary;
      margin: 15px 0 10px;
    }

    .settings-list {
      background: $bg-lighter;
      border-radius: 12px;
      padding: 12px 16px;
      margin-bottom: 20px;

      .settings-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 0;

        &:not(:last-child) {
          border-bottom: 1px solid #f0f0f0;
        }

        span {
          font-size: 14px;
          color: $text-primary;
        }
      }
    }

    .filter-options {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding: 5px 0 15px;
    }
  }
}

/* 雷达面板样式 */
.radar-panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  background-color: #fff;

  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;

    span {
      font-size: 16px;
      font-weight: bold;
      color: $text-primary;
    }

    .close-btn {
      position: absolute;
      right: 10px;
      top: 10px;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;

      svg {
        font-size: 18px;
        color: $text-secondary;
      }
    }
  }

  /* 雷达要素卡片式布局 */
  .radar-element-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;

    .radar-element-card {
      flex: 1;
      min-width: 90px;
      padding: 10px 8px;
      text-align: center;
      background-color: $bg-light;
      border-radius: 8px;
      font-size: 13px;
      color: $text-secondary;
      border: 1px solid transparent;
      cursor: pointer;
      transition: all 0.2s;

      &.active {
        background-color: #e1f1ff;
        color: $primary-color;
        border-color: $primary-color;
        font-weight: 500;
      }
    }
  }

  /* 时间显示和控制 */
  .radar-time-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;

    .radar-time-display {
      display: flex;
      align-items: center;
      background-color: $bg-light;
      padding: 8px 12px;
      border-radius: 8px;
      font-size: 14px;
      color: $text-primary;
      cursor: pointer;
      flex: 1;
      margin-right: 10px;

      .time-icon {
        margin-right: 8px;
        color: $primary-color;
      }

      .time-text {
        flex: 1;
        font-weight: 500;
      }

      .time-arrow {
        margin-left: 5px;
        color: #999;
      }
    }

    .radar-control-buttons {
      display: flex;
      gap: 8px;

      .van-button {
        border-radius: 6px;
        font-size: 12px;
        height: 36px;
        padding: 0 5px;

        .van-icon {
          font-size: 14px;
          margin-right: 2px;
        }
      }
    }
  }

  /* 时间轴样式 */
  .radar-time-axis {
    margin-bottom: 20px;

    .time-axis-controls {
      display: flex;
      align-items: center;
      position: relative;

      .scroll-btn {
        flex: 0 0 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(52, 120, 246, 0.1);
        color: $primary-color;
        border-radius: 50%;
        cursor: pointer;
        z-index: 1;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        transition: all 0.2s;
        
        &:active {
          background-color: rgba(52, 120, 246, 0.2);
          transform: scale(0.95);
        }
      }
    }

    .time-axis-container {
      overflow-x: auto;
      padding: 8px 0;
      scrollbar-width: thin;
      -webkit-overflow-scrolling: touch; /* 增强iOS滚动体验 */
      position: relative; /* 为定位子元素做准备 */
      flex: 1;
      margin: 0 4px;

      &::-webkit-scrollbar {
        height: 4px;
      }

      &::-webkit-scrollbar-track {
        background: #f0f0f0;
        border-radius: 2px;
      }

      &::-webkit-scrollbar-thumb {
        background: #c0c0c0;
        border-radius: 2px;
      }

      .time-axis {
        display: flex;
        min-width: fit-content;
        padding: 0 4px;

        .time-point {
          flex: 0 0 auto;
          padding: 6px 8px;
          margin-right: 8px;
          background-color: $bg-light;
          border-radius: 6px;
          font-size: 14px;
          cursor: pointer;
          white-space: nowrap;
          border: 1px solid #e0e0e0;
          user-select: none;

          &.active {
            background-color: $primary-color;
            color: white;
            border-color: $primary-color;
          }
        }

        .empty-time-data {
          width: 100%;
          // padding: 20px 0;
          display: flex;
          justify-content: center;
          align-items: center;
          color: #999;
          font-size: 14px;

          :deep(.van-empty) {
            // padding: 10px 0;

            .van-empty__image {
              width: 60px;
              height: 50px;
            }

            .van-empty__description {
              margin-top: 10px;
              color: #999;
              font-size: 10px;
            }
          }
        }
      }
    }
  }

  /* 设置区块样式 */
  .radar-settings-block {
    margin-bottom: 20px;
    background-color: $bg-lighter;
    border-radius: 10px;
    overflow: hidden;

    .settings-title {
      display: flex;
      align-items: center;
      padding: 10px 12px;
      background-color: #f0f3f8;
      border-bottom: 1px solid $border-color;

      .title-icon {
        width: 3px;
        height: 14px;
        background-color: $primary-color;
        border-radius: 2px;
        margin-right: 8px;
      }

      span {
        font-size: 14px;
        font-weight: 500;
        color: $text-primary;
      }
    }

    .settings-content {
      padding: 12px;

      .threshold-label {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;

        span {
          font-size: 13px;
          color: $text-secondary;
        }

        .threshold-value {
          color: $primary-color;
          font-weight: 500;
        }
      }

      .point-row {
        display: flex;
        align-items: center;
        margin-bottom: 12px;

        .point-label {
          width: 30px;
          font-size: 13px;
          color: $text-secondary;
        }

        .coord-inputs {
          display: flex;
          flex: 1;
          align-items: center;

          .coord-input {
            flex: 1;
            height: 34px;
            margin: 0 4px;
            background-color: $bg-light;
            border-radius: 4px;

            :deep(.van-field__control) {
              color: $text-primary;
              font-size: 12px;
            }
          }

          .btn-pick {
            width: 34px;
            height: 34px;
            padding: 0;
            margin-left: 4px;
            border: none;
            background-color: $primary-color;

            .van-icon {
              color: #fff;
            }
          }
        }
      }

      .action-buttons {
        .btn-pick-point {
          margin-bottom: 8px;
          height: 38px;
          border-radius: 6px;
          font-size: 14px;
        }

        .sub-buttons {
          display: flex;
          justify-content: space-between;

          .van-button {
            width: 48%;
            height: 36px;
            border-radius: 6px;
            font-size: 13px;
          }
        }
      }
    }
  }

  /* 兼容紧凑模式 */
  &.compact {
    padding: 10px 12px;
    color: $text-primary;
  }
}

/* 雷达控制区域 */
.radar-controls {
  margin-bottom: 10px;
}

/* 日期选择器容器样式 */
.date-picker-container {
  padding: 0;
  background-color: #fff;
  max-height: 60vh;
  overflow: hidden;

  :deep(.van-date-picker__toolbar) {
    border-bottom: 1px solid #f0f0f0;
  }

  :deep(.van-picker) {
    background-color: #fff;
    height: auto;

    .van-picker-column__item--selected {
      color: $primary-color;
      font-weight: bold;
    }
  }

  /* 确保日期选择器显示完整 */
  :deep(.van-picker-column) {
    height: 44vh;
  }
}

.site-panel {
  padding: 16px;

  .panel-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
  }

  .device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;

    .device-item {
      display: flex;
      align-items: center;
      justify-content: space-between;

      .device-icon {
        font-size: 20px;
        margin-right: 8px;
      }

      .device-name {
        font-size: 14px;
        margin-right: 8px;
      }

      .device-count {
        color: #409eff;
        font-weight: bold;
      }
    }
  }

  .panel-actions {
    margin-top: 20px;
  }
}

.site-panel-pc {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;

  .card {
    background: #f7faff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 16px;
    margin-bottom: 0;

    .card-title {
      font-size: 15px;
      font-weight: bold;
      color: #3478f6;
      margin-bottom: 12px;
    }
  }

  .device-type-list,
  .stat-list {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
  }

  .device-type-item,
  .stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
  }

  .device-icon,
  .stat-icon {
    font-size: 28px;
  }

  .stat-count {
    color: #3478f6;
    font-size: 18px;
    font-weight: bold;
    margin-left: 4px;
  }

  .setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
  }
}

.mobile-panel {
  padding: 12px 12px 20px 12px;

  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 16px;

    svg {
      font-size: 20px;
      cursor: pointer;
    }
  }

  .device-scroll {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 5px;

    &::-webkit-scrollbar {
      display: none;
    }

    .device-card {
      min-width: 52px;
      background: #f4f8ff;
      border-radius: 14px;
      box-shadow: 0 2px 8px rgba(52, 120, 246, 0.06);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 10px 8px;
      cursor: pointer;
      border: 2px solid transparent;
      transition: all 0.2s;

      &.active {
        border: 2px solid #3478f6;
        background: #eaf2ff;
      }

      .device-icon {
        width: 25px;
        height: 25px;
        object-fit: contain;
      }

      .device-name {
        font-size: 13px;
      }
    }
  }

  .stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;

    .stat-block {
      flex: 1;
      background: #fff;
      border-radius: 12px;
      box-shadow: 0 2px 8px rgba(52, 120, 246, 0.04);
      display: flex;
      flex-direction: column;
      align-items: center;
      margin: 0 4px;
      padding: 10px 0;

      .stat-icon {
        font-size: 22px;
        margin-bottom: 2px;
        color: #3478f6;
      }

      .stat-count {
        color: #3478f6;
        font-size: 20px;
        font-weight: bold;
      }

      .stat-name {
        font-size: 12px;
        color: #666;
        margin-top: 2px;
      }
    }
  }

  .setting-list {
    background: #fff;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);

    .setting-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      padding: 5px 0;
      font-size: 14px;
      color: #333;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }
}

.profile-action-group {
  display: flex;
  flex-direction: column;
  gap: 8px;

  .pick-action-btn {
    height: 40px;
    border-radius: 6px;
    font-size: 15px;
    background-color: #3478f6;
    border: none;
  }

  .sub-actions {
    display: flex;
    justify-content: space-between;

    .van-button {
      width: 48%;
      height: 36px;
      border-radius: 6px;
    }
  }
}

/* 紧凑版雷达面板样式 */
.panel-drag-indicator.mini {
  height: 20px;

  .drag-handle {
    width: 30px;
    height: 3px;
    margin-bottom: 2px;
  }

  .mini-text {
    font-size: 9px;
    transform: translateY(-2px);
  }
}

.radar-panel.compact {
  padding: 10px 12px;
  color: #333;

  .panel-header.compact {
    padding-bottom: 8px;
    margin-bottom: 10px;
    font-size: 15px;
    border-bottom: 1px solid #eaedf0;

    .close-btn {
      font-size: 16px;
    }
  }
}

/* 紧凑版雷达要素选择器 - 重新设计为选项卡 */
.radar-element-selector.compact {
  margin-bottom: 10px;

  .element-tabs {
    display: flex;
    background-color: #f5f7fa;
    border-radius: 4px;
    overflow: hidden;

    .element-tab {
      flex: 1;
      text-align: center;
      padding: 8px 0;
      font-size: 12px;
      color: #666;
      cursor: pointer;
      transition: all 0.2s ease;

      &.active {
        background-color: #3478f6;
        color: white;
        font-weight: 500;
      }
    }
  }
}

/* 紧凑版当前时间显示 */
.radar-current-time.compact {
  margin-bottom: 10px;

  .time-display-card.compact {
    padding: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    background-color: #3478f6;
    color: white;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;

    span {
      margin: 0 8px;
    }
  }

  .time-control-buttons.compact {
    display: flex;
    justify-content: space-between;

    .van-button {
      flex: 1;
      height: 28px;
      font-size: 12px;
      margin: 0 3px;
      border-radius: 4px;
    }
  }
}

/* 紧凑版时间选择器 */
.current-time-picker.compact {
  .time-picker-header.compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f7f8fa;
    border-bottom: 1px solid #ebedf0;

    .title {
      font-size: 14px;
      font-weight: bold;
      color: #323233;
    }

    .cancel,
    .confirm {
      font-size: 12px;
      padding: 4px 8px;
    }

    .confirm {
      color: #3478f6;
    }
  }
}

/* 紧凑版时间轴 */
.radar-time-control.compact {
  margin-bottom: 12px;

  .time-axis-container.compact {
    padding: 5px 0;
    overflow-x: auto;

    &::-webkit-scrollbar {
      height: 3px;
    }

    &::-webkit-scrollbar-track {
      background: #f0f0f0;
    }

    &::-webkit-scrollbar-thumb {
      background: #ccc;
      border-radius: 2px;
    }

    .time-axis.compact {
      display: flex;

      .time-point.compact {
        padding: 5px 8px;
        margin-right: 6px;
        font-size: 12px;
        font-weight: normal;
        background-color: #f5f7fa;
        border-radius: 4px;
        white-space: nowrap;

        &.active {
          background-color: #3478f6;
          color: white;
        }
      }
    }
  }
}

/* 统一的设置模块样式 */
.setting-block.compact {
  margin-bottom: 12px;
  background-color: #f5f7fa;
  border-radius: 6px;
  overflow: hidden;

  .setting-title {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background-color: #f0f3f8;

    .title-bar {
      width: 3px;
      height: 12px;
      background-color: #3478f6;
      margin-right: 8px;
      border-radius: 3px;
    }
  }

  .setting-content {
    padding: 10px;

    .compact-label {
      display: flex;
      justify-content: space-between;
      margin-bottom: 6px;
      font-size: 12px;

      .value-range {
        color: #3478f6;
      }
    }
  }
}

/* 更小紧凑的剖面拾点样式 - 修复文字不可见问题 */
.mini-picking-container {
  margin-bottom: 8px;

  .point-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 4px 6px;

    .mini-label {
      font-size: 12px;
      color: #333;
      width: 30px;
    }

    .input-pair {
      display: flex;
      flex: 1;

      .mini-input {
        height: 28px;
        border-radius: 3px;
        margin: 0 2px;
        flex: 1;
        padding: 0;
        background-color: rgba(255, 255, 255, 0.6);


        :deep(.van-field__control) {
          color: #fff;
          font-size: 12px;
        }

        :deep(.van-field__body) {
          height: 100%;
        }
      }
    }

    .mini-btn {
      min-width: 28px;
      height: 28px;
      padding: 0;
      margin-left: 4px;
      border: none;
      background-color: #3478f6;

      .van-icon {
        font-size: 14px;
        color: #fff;
      }
    }
  }
}